import { Component } from '@angular/core';
import { Platform, NavController, NavParams } from 'ionic-angular';
import { Api } from '../../providers/api';
import { PubApi } from '../../providers/pubapi';
import { supervisiondocPage } from '../supervisiondoc/supervisiondoc';//
import { Fun } from '../../providers/fun';
declare var $;

@Component({
      selector: 'page-documents',
      templateUrl: 'documents.html'
})


export class DocumentsPage {
      documents: any;
      content: any;
      key: any;
      constructor(public platform: Platform, public navParams: NavParams, public navCtrl: NavController, public api: Api, public pubapi: PubApi) {
            var slef = this;
            this.key = navParams.get("key");
            platform.ready().then(() => {





            });
      };

      getAll(item) {

      }


      ionViewDidEnter() {

            //单击
            $("#Js_Tree li").click(function (event) {
                  event.stopPropagation();
                  var sonUl = $(this).find("ul").eq(0);
                  if (sonUl.is(':hidden')) {
                        sonUl.show();
                  }
                  else {
                        sonUl.hide();
                  }

            });
            var that = this;
            this.pubapi.get("/SupervisionFileTpl/GetDoucumentFileAllData?eKey=" + this.key, function (res) {
                  var result = res.data;
                  that.content = result;

            })
      }
      opendoclis(item) {
            var that = this;
            let key=Fun.getcookie("key");
            this.pubapi.get("FormData/GetApproval?ekey=" + that.key + "&fKey=" + item + "&userKey=" + Fun.getcookie("key") + "", function (res) {
                  let r = res.data;
                  if (r.length > 0) {
                          that.navCtrl.push(supervisiondocPage, {
                              prokey: that.key, fkey: item

                        });

                      
                  }
                  else {
                      
                  }


            })


      }
}